<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.shop.common.Constants" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>${param.title} - <%= Constants.Config.SYSTEM_NAME %>
    </title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.6.0.min.js"></script>
</head>
<body>
<div class="header">
    <div class="logo">
        <a href="${pageContext.request.contextPath}/"><%= Constants.Config.SYSTEM_NAME %>
        </a>
    </div>
    <div class="nav">
        <%
            String userKey = Constants.Session.USER;
            request.setAttribute("userKey", userKey);
        %>
        <c:if test="${empty sessionScope[userKey]}">
            <a href="${pageContext.request.contextPath}/user/login">登录</a>
            <a href="${pageContext.request.contextPath}/user/register">注册</a>
        </c:if>

        <c:if test="${sessionScope.userType=='admin'}">
            <a href="${pageContext.request.contextPath}/admin/">后台管理</a>
        </c:if>


        <c:if test="${not empty sessionScope[userKey]}">
            <a href="${pageContext.request.contextPath}/user/selfInfo">
                <c:if test="${not empty sessionScope[userKey].avatar}">
                    <img style="width: 35px; height: 35px;border-radius: 50%" src="${sessionScope[userKey].avatar}" alt="头像"/>
                </c:if>
                <c:if test="${empty sessionScope[userKey].avatar}">
                    <img style="width: 35px; height: 35px;border-radius: 50%" src="http://localhost:9000/e-commerce/b4b5fd3838fd48baa7a0fc51c36ca002.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20250426%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250426T064532Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=b988094c1d48b53a181d12a270f36f5e796d261affca83eaa0a3f1940306afa7" alt="默认头像"/>
                </c:if>
                    ${sessionScope[userKey].username}
            </a>
            <a href="${pageContext.request.contextPath}/cart/show">购物车</a>
            <a href="${pageContext.request.contextPath}/order/">我的订单</a>
            <a href="${pageContext.request.contextPath}/user/logout">退出</a>
        </c:if>



    </div>
</div>
<div class="content">
</div>